﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:src="clr-namespace:WGM_Client_Net35"
	xmlns:settings="clr-namespace:WGM_Client_Net35.Properties"
    xmlns:WGM_Client_Net35_Properties="clr-namespace:WGM_Client_Net35.Properties" 
    xmlns:Microsoft_Windows_Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
    x:Class="WGM_Client_Net35.MainWindow"
    Title="WGM Beta" 
    Closing="Window_Closing" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">

    <Window.Resources>
        <ColumnDefinition x:Key="clWidth" Width="150" x:Name="clWidth"/>
        <DataTemplate x:Key="ContactListTemplate">
            <StackPanel>
                <TextBlock   FontWeight="Bold" Grid.ColumnSpan="2" TextTrimming="CharacterEllipsis" Text="{Binding Path=DisplayName}" ToolTip="{Binding Path=DisplayTooltip}" Foreground="{Binding Path=DisplayNameColour}" FontSize="13"  FontFamily="Verdana">
                    <TextBlock.Effect>
                        <DropShadowEffect Color="LightGreen"  x:Name="tbGlow" Opacity="0"/>
                    </TextBlock.Effect>
                </TextBlock>
                <TextBlock  Visibility="{Binding Path=DisplayStatusVisiblity}" Grid.Column="1" Grid.Row="1" TextTrimming="WordEllipsis" ToolTip="{Binding Path=DisplayTooltip}" Foreground="{Binding Path=DisplayNameColour}"  FontFamily="Verdana" FontSize="10" FontStyle="Italic" Text="{Binding Path=DisplayStatus, StringFormat='  \{0\}'}" Width="{Binding Path=ActualWidth, ElementName=ContactScroller, NotifyOnSourceUpdated=True}"/>
                <Separator Width="Auto" Height="1" Opacity="0" />
            </StackPanel>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=FlashContact}" Value="True"   >
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Duration="00:00:01" AutoReverse="False" RepeatBehavior="3x" Storyboard.TargetName="tbGlow" Storyboard.TargetProperty="Opacity">
                                    <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                    <LinearDoubleKeyFrame KeyTime="00:00:0.5" Value="1"/>
                                    <LinearDoubleKeyFrame KeyTime="00:00:1" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
        <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
            <ControlTemplate.Resources>
                <Storyboard x:Key="FadScrollBarIn">
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PART_VerticalScrollBar" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
                        <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
                <Storyboard x:Key="FadeScrollBarOut">
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PART_VerticalScrollBar" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                        <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.5"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </ControlTemplate.Resources>
            <Grid x:Name="Grid" Background="{TemplateBinding Background}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Rectangle x:Name="Corner" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Column="1" Grid.Row="1"/>
                <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Grid.Column="0" Grid.Row="0" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                <ScrollBar Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Cursor="Arrow" x:Name="PART_VerticalScrollBar" Style="{DynamicResource ScrollBarStyle1}" Grid.Column="1" Grid.Row="0" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="VerticalScrollBar" Opacity="0.5"/>
                <ScrollBar Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Cursor="Arrow" x:Name="PART_HorizontalScrollBar" Grid.Column="0" Grid.Row="1" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="HorizontalScrollBar"/>
            </Grid>
            <ControlTemplate.Triggers>
                <EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="PART_VerticalScrollBar">
                    <BeginStoryboard x:Name="FadScrollBarIn_BeginStoryboard" Storyboard="{StaticResource FadScrollBarIn}"/>
                </EventTrigger>
                <EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="PART_VerticalScrollBar">
                    <BeginStoryboard x:Name="FadeScrollBarOut_BeginStoryboard" Storyboard="{StaticResource FadeScrollBarOut}"/>
                </EventTrigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <Style x:Key="ScrollBarStyle1" TargetType="{x:Type ScrollBar}">
            <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
            <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="BorderThickness" Value="0,0,0,0"/>
            <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
            <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollBar}">
                        <Grid Width="14" Background="#00E2E2E2">
                            <Grid.RowDefinitions>
                                <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                <RowDefinition Height="1E-05*"/>
                                <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                            </Grid.RowDefinitions>
                            <Viewbox Stretch="Fill" Opacity="0.5">
                                <RepeatButton MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Height="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}" Content="M 0 4 L 7 4 L 3.5 0 Z" Command="ScrollBar.LineUpCommand" Foreground="#FFFFFFFF" Background="#FF374862">
                                    <RepeatButton.Style>
                                        <Style TargetType="{x:Type RepeatButton}">
                                            <Setter Property="OverridesDefaultStyle" Value="True"/>
                                            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>

                                            <Setter Property="BorderThickness" Value="2,2,2,2"/>
                                            <Setter Property="MinWidth" Value="0"/>
                                            <Setter Property="MinHeight" Value="0"/>
                                            <Setter Property="IsTabStop" Value="False"/>
                                            <Setter Property="Focusable" Value="False"/>
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                        <Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
                                                            <Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                        </Microsoft_Windows_Themes1:ClassicBorderDecorator>
                                                        <ControlTemplate.Triggers>
                                                            <Trigger Property="IsPressed" Value="True">
                                                                <Setter Property="BorderStyle" TargetName="ClassicBorder" Value="AltPressed"/>
                                                            </Trigger>
                                                            <Trigger Property="IsEnabled" Value="False">
                                                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                                                            </Trigger>
                                                        </ControlTemplate.Triggers>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </RepeatButton.Style>
                                </RepeatButton>
                            </Viewbox>
                            <Rectangle Grid.Row="1" Opacity="0" OpacityMask="#FF000000">
                                <Rectangle.Stroke>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFE6E6E6" Offset="0"/>
                                        <GradientStop Color="#FF072E49" Offset="1"/>
                                    </LinearGradientBrush>
                                </Rectangle.Stroke>
                                <Rectangle.Fill>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FF7B90BD" Offset="0"/>
                                        <GradientStop Color="#FF0F2045" Offset="1"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <Track x:Name="PART_Track" Grid.Row="1" IsDirectionReversed="True">
                                <Track.OpacityMask>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFF2F9FD" Offset="0"/>
                                        <GradientStop Color="#FF33607B" Offset="0.987"/>
                                    </LinearGradientBrush>
                                </Track.OpacityMask>
                                <Track.Thumb>
                                    <Thumb Background="#FFA86666">
                                        <Thumb.Style>
                                            <Style TargetType="{x:Type Thumb}">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type Thumb}">
                                                            <Microsoft_Windows_Themes1:ClassicBorderDecorator BorderStyle="Raised" BorderThickness="3,3,3,3">
                                                                <Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                                                                    <SolidColorBrush/>
                                                                </Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                                                                <Microsoft_Windows_Themes1:ClassicBorderDecorator.Background>
                                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                        <GradientStop Color="#FFD0DBE0" Offset="0"/>
                                                                        <GradientStop Color="#FF70A0B7" Offset="1"/>
                                                                    </LinearGradientBrush>
                                                                </Microsoft_Windows_Themes1:ClassicBorderDecorator.Background>
                                                            </Microsoft_Windows_Themes1:ClassicBorderDecorator>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Thumb.Style>
                                    </Thumb>
                                </Track.Thumb>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton Command="ScrollBar.PageDownCommand" Opacity="0">
                                        <RepeatButton.Style>
                                            <Style TargetType="{x:Type RepeatButton}">
                                                <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                <Setter Property="IsTabStop" Value="False"/>
                                                <Setter Property="Focusable" Value="False"/>
                                                <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
                                                <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                            <Rectangle x:Name="PageButtonBackground" Fill="#00FFFFFF"/>
                                                            <ControlTemplate.Triggers>
                                                                <Trigger Property="IsPressed" Value="True">
                                                                    <Setter Property="Fill" TargetName="PageButtonBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                                                                </Trigger>
                                                            </ControlTemplate.Triggers>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </RepeatButton.Style>
                                    </RepeatButton>
                                </Track.IncreaseRepeatButton>
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton Command="ScrollBar.PageUpCommand" Opacity="0">
                                        <RepeatButton.Style>
                                            <Style TargetType="{x:Type RepeatButton}">
                                                <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                <Setter Property="IsTabStop" Value="False"/>
                                                <Setter Property="Focusable" Value="False"/>
                                                <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
                                                <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                            <Rectangle x:Name="PageButtonBackground" Fill="#00FFFFFF"/>
                                                            <ControlTemplate.Triggers>
                                                                <Trigger Property="IsPressed" Value="True">
                                                                    <Setter Property="Fill" TargetName="PageButtonBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                                                                </Trigger>
                                                            </ControlTemplate.Triggers>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </RepeatButton.Style>
                                    </RepeatButton>
                                </Track.DecreaseRepeatButton>
                            </Track>
                            <Viewbox Grid.Row="2" Stretch="Fill" Opacity="0.5">
                                <RepeatButton MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Height="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}" Content="M 0 0 L 3.5 4 L 7 0 Z" Command="ScrollBar.LineDownCommand" Foreground="#FFFFFFFF" Background="#FF374862">
                                    <RepeatButton.Style>
                                        <Style TargetType="{x:Type RepeatButton}">
                                            <Setter Property="OverridesDefaultStyle" Value="True"/>
                                            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                            <Setter Property="BorderBrush">
                                                <Setter.Value>
                                                    <SolidColorBrush/>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="BorderThickness" Value="2,2,2,2"/>
                                            <Setter Property="MinWidth" Value="0"/>
                                            <Setter Property="MinHeight" Value="0"/>
                                            <Setter Property="IsTabStop" Value="False"/>
                                            <Setter Property="Focusable" Value="False"/>
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                        <Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
                                                            <Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                        </Microsoft_Windows_Themes1:ClassicBorderDecorator>
                                                        <ControlTemplate.Triggers>
                                                            <Trigger Property="IsPressed" Value="True">
                                                                <Setter Property="BorderStyle" TargetName="ClassicBorder" Value="AltPressed"/>
                                                            </Trigger>
                                                            <Trigger Property="IsEnabled" Value="False">
                                                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                                                            </Trigger>
                                                        </ControlTemplate.Triggers>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </RepeatButton.Style>
                                </RepeatButton>
                            </Viewbox>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="Orientation" Value="Horizontal">
                    <Setter Property="Width" Value="NaN"/>
                    <Setter Property="MinWidth" Value="0"/>
                    <Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                    <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ScrollBar}">
                                <Grid Background="{TemplateBinding Background}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                        <ColumnDefinition Width="1E-05*"/>
                                        <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                    </Grid.ColumnDefinitions>
                                    <Viewbox Stretch="Fill">
                                        <RepeatButton MinHeight="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" Width="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" Content="M 0 4 L 4 8 L 4 0 Z" Command="ScrollBar.LineLeftCommand">
                                            <RepeatButton.Style>
                                                <Style TargetType="{x:Type RepeatButton}">
                                                    <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                                    <Setter Property="BorderBrush">
                                                        <Setter.Value>
                                                            <SolidColorBrush/>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Setter Property="BorderThickness" Value="2,2,2,2"/>
                                                    <Setter Property="MinWidth" Value="0"/>
                                                    <Setter Property="MinHeight" Value="0"/>
                                                    <Setter Property="IsTabStop" Value="False"/>
                                                    <Setter Property="Focusable" Value="False"/>
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                <Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
                                                                    <Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                                </Microsoft_Windows_Themes1:ClassicBorderDecorator>
                                                                <ControlTemplate.Triggers>
                                                                    <Trigger Property="IsPressed" Value="True">
                                                                        <Setter Property="BorderStyle" TargetName="ClassicBorder" Value="AltPressed"/>
                                                                    </Trigger>
                                                                    <Trigger Property="IsEnabled" Value="False">
                                                                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                                                                    </Trigger>
                                                                </ControlTemplate.Triggers>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </RepeatButton.Style>
                                        </RepeatButton>
                                    </Viewbox>
                                    <Rectangle Grid.Column="1">
                                        <Rectangle.Fill>
                                            <SolidColorBrush Opacity="0.5" Color="#FFFFFFFF"/>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <Track x:Name="PART_Track" Grid.Column="1">
                                        <Track.Thumb>
                                            <Thumb>
                                                <Thumb.Style>
                                                    <Style TargetType="{x:Type Thumb}">
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type Thumb}">
                                                                    <Microsoft_Windows_Themes1:ClassicBorderDecorator Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderStyle="Raised" BorderThickness="3,3,3,3">
                                                                        <Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                                                                            <SolidColorBrush/>
                                                                        </Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                                                                    </Microsoft_Windows_Themes1:ClassicBorderDecorator>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </Thumb.Style>
                                            </Thumb>
                                        </Track.Thumb>
                                        <Track.IncreaseRepeatButton>
                                            <RepeatButton Command="ScrollBar.PageRightCommand">
                                                <RepeatButton.Style>
                                                    <Style TargetType="{x:Type RepeatButton}">
                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                        <Setter Property="IsTabStop" Value="False"/>
                                                        <Setter Property="Focusable" Value="False"/>
                                                        <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                                                        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                    <Rectangle x:Name="PageButtonBackground" Fill="#00FFFFFF"/>
                                                                    <ControlTemplate.Triggers>
                                                                        <Trigger Property="IsPressed" Value="True">
                                                                            <Setter Property="Fill" TargetName="PageButtonBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                                                                        </Trigger>
                                                                    </ControlTemplate.Triggers>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </RepeatButton.Style>
                                            </RepeatButton>
                                        </Track.IncreaseRepeatButton>
                                        <Track.DecreaseRepeatButton>
                                            <RepeatButton Command="ScrollBar.PageLeftCommand">
                                                <RepeatButton.Style>
                                                    <Style TargetType="{x:Type RepeatButton}">
                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                        <Setter Property="IsTabStop" Value="False"/>
                                                        <Setter Property="Focusable" Value="False"/>
                                                        <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                                                        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                    <Rectangle x:Name="PageButtonBackground" Fill="#00FFFFFF"/>
                                                                    <ControlTemplate.Triggers>
                                                                        <Trigger Property="IsPressed" Value="True">
                                                                            <Setter Property="Fill" TargetName="PageButtonBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                                                                        </Trigger>
                                                                    </ControlTemplate.Triggers>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </RepeatButton.Style>
                                            </RepeatButton>
                                        </Track.DecreaseRepeatButton>
                                    </Track>
                                    <Viewbox Grid.Column="2" Stretch="Fill">
                                        <RepeatButton MinHeight="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" Width="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" Content="M 0 0 L 0 8 L 4 4 Z" Command="ScrollBar.LineRightCommand">
                                            <RepeatButton.Style>
                                                <Style TargetType="{x:Type RepeatButton}">
                                                    <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                                    <Setter Property="BorderBrush">
                                                        <Setter.Value>
                                                            <SolidColorBrush/>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Setter Property="BorderThickness" Value="2,2,2,2"/>
                                                    <Setter Property="MinWidth" Value="0"/>
                                                    <Setter Property="MinHeight" Value="0"/>
                                                    <Setter Property="IsTabStop" Value="False"/>
                                                    <Setter Property="Focusable" Value="False"/>
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                <Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
                                                                    <Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"/>
                                                                </Microsoft_Windows_Themes1:ClassicBorderDecorator>
                                                                <ControlTemplate.Triggers>
                                                                    <Trigger Property="IsPressed" Value="True">
                                                                        <Setter Property="BorderStyle" TargetName="ClassicBorder" Value="AltPressed"/>
                                                                    </Trigger>
                                                                    <Trigger Property="IsEnabled" Value="False">
                                                                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                                                                    </Trigger>
                                                                </ControlTemplate.Triggers>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </RepeatButton.Style>
                                        </RepeatButton>
                                    </Viewbox>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="ContactListItemStyle" TargetType="{x:Type ListBoxItem}">
            <EventSetter Event="Control.MouseDoubleClick" Handler="ContactListDoubleClick" />
            <Setter Property="Background" Value="#00FFFFFF"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Padding" Value="2,0,0,0"/>

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="FadeInContactListItem">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                    <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="GlowContact" AutoReverse="True" RepeatBehavior="3x">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                    <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Border SnapsToDevicePixels="True"  x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">

                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                                <BeginStoryboard Storyboard="{StaticResource FadeInContactListItem}" x:Name="FadeInContactListItem_BeginStoryboard"/>
                            </EventTrigger>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="Background" TargetName="Bd">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5" Opacity="0.5">
                                            <GradientStop Color="#00FFFFFF" Offset="1"/>
                                            <GradientStop Color="{Binding Path=DisplayHighlightColour}" Offset="0"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsSelected" Value="True"/>
                                    <Condition Property="Selector.IsSelectionActive" Value="False"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Background" TargetName="Bd">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5" Opacity="0.2">
                                            <GradientStop Color="#00FFFFFF" Offset="1"/>
                                            <GradientStop Color="{Binding Path=DisplayHighlightColour}" Offset="0"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </MultiTrigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>

                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Storyboard x:Key="SubtleChange" Storyboard.TargetName="middleStop" Storyboard.TargetProperty="Color">
            <ColorAnimation  To="#FF5A8EA2" From="#FFFFFFFF"  Duration="00:00:30" AutoReverse="True" RepeatBehavior="Forever"/>
        </Storyboard>
        <Storyboard x:Key="FadeIn" >
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="menu" Storyboard.TargetProperty="(UIElement.Opacity)">
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:01.7000000" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.Opacity)">
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:03" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border1" Storyboard.TargetProperty="(UIElement.Opacity)">
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:03.3000000" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Geometry x:Key="Checkmark">M 0,5.1 L 1.7,5.2 L 3.4,7.1 L 8,0.4 L 9.2,0 L 3.3,10.8 Z</Geometry>
        <Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
        <Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
        <Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>
        <Style x:Key="MenuItemStyle2" TargetType="{x:Type MenuItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Background" Value="#00FFFFFF"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
            <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
            <Style.Triggers>
                <Trigger Property="Role" Value="TopLevelHeader">
                    <Setter Property="Margin" Value="0,1,0,1"/>
                    <Setter Property="Padding" Value="4,1,5,2"/>
                    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
                <Trigger Property="Role" Value="TopLevelItem">
                    <Setter Property="Margin" Value="0,1,0,1"/>
                    <Setter Property="Padding" Value="4,1,5,2"/>
                    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
                <Trigger Property="Role" Value="SubmenuHeader">
                    <Setter Property="DockPanel.Dock" Value="Top"/>
                    <Setter Property="Padding" Value="0,2,0,2"/>
                </Trigger>
                <Trigger Property="Role" Value="SubmenuItem">
                    <Setter Property="DockPanel.Dock" Value="Top"/>
                    <Setter Property="Padding" Value="0,2,0,2"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <ControlTemplate x:Key="MenuItemControlTemplate2" TargetType="{x:Type MenuItem}">
            <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="#00E6CFCF">
                <Grid Background="#00000000">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition MinWidth="17" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
                        <ColumnDefinition Width="14"/>
                    </Grid.ColumnDefinitions>
                    <ContentPresenter Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" Content="{TemplateBinding Icon}" ContentSource="Icon"/>
                    <Path Visibility="Hidden" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z"/>
                    <ContentPresenter Margin="{TemplateBinding Padding}" Grid.Column="1" Content="{TemplateBinding Header}" ContentSource="Header" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" RecognizesAccessKey="True"/>
                    <Path Margin="4,0,6,0" x:Name="ArrowPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Grid.Column="3" Data="M0,0L4,3.5 0,7z" DockPanel.Dock="Right"/>
                    <Popup Focusable="False" AllowsTransparency="True" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-2" x:Name="PART_Popup">
                        <Microsoft_Windows_Themes1:SystemDropShadowChrome x:Name="Shdw" Color="#00FFFFFF">
                            <Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="SubMenuBorder" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderStyle="AltRaised" BorderThickness="2,2,2,2">
                                <Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                                    <SolidColorBrush/>
                                </Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                                <ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="True">
                                    <ItemsPresenter Grid.IsSharedSizeScope="True" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
                                </ScrollViewer>
                            </Microsoft_Windows_Themes1:ClassicBorderDecorator>
                        </Microsoft_Windows_Themes1:SystemDropShadowChrome>
                    </Popup>
                </Grid>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsSuspendingPopupAnimation" Value="True">
                    <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
                </Trigger>
                <Trigger Property="Icon" Value="{x:Null}">
                    <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
                </Trigger>
                <Trigger Property="IsChecked" Value="True">
                    <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
                    <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
                </Trigger>
                <Trigger Property="IsHighlighted" Value="True">
                    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                </Trigger>
                <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="True">
                    <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                    <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="MenuItemControlTemplate1" TargetType="{x:Type MenuItem}">
            <Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Background="{TemplateBinding Background}" BorderStyle="None" BorderThickness="1,1,1,1">
                <Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                    <SolidColorBrush/>
                </Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                <DockPanel x:Name="DockPanel">
                    <ContentPresenter Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" Content="{TemplateBinding Icon}" ContentSource="Icon"/>
                    <Path Visibility="Collapsed" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z"/>
                    <ContentPresenter Margin="{TemplateBinding Padding}" x:Name="ContentPresenter" Content="{TemplateBinding Header}" ContentSource="Header" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" RecognizesAccessKey="True"/>
                    <Popup Focusable="False" AllowsTransparency="True" HorizontalOffset="-2" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" x:Name="PART_Popup">
                        <Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="SubMenuBorder" Width="Auto" Height="Auto" Background="#CC473E3E" BorderStyle="AltRaised" BorderThickness="2,2,2,2">
                            <Microsoft_Windows_Themes1:ClassicBorderDecorator.Effect>
                                <DropShadowEffect Color="#FF4D4D4D" ShadowDepth="10"/>
                            </Microsoft_Windows_Themes1:ClassicBorderDecorator.Effect>
                            <Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                                <SolidColorBrush/>
                            </Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
                            <ScrollViewer x:Name="ScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="True">
                                <ItemsPresenter x:Name="ItemsPresenter" Grid.IsSharedSizeScope="True" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
                            </ScrollViewer>
                        </Microsoft_Windows_Themes1:ClassicBorderDecorator>
                    </Popup>
                </DockPanel>
            </Microsoft_Windows_Themes1:ClassicBorderDecorator>
            <ControlTemplate.Triggers>
                <Trigger Property="IsSuspendingPopupAnimation" Value="True">
                    <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
                </Trigger>
                <Trigger Property="Icon" Value="{x:Null}">
                    <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
                </Trigger>
                <Trigger Property="IsChecked" Value="True">
                    <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
                    <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
                </Trigger>
                <Trigger Property="IsHighlighted" Value="True">
                    <Setter Property="BorderStyle" TargetName="ClassicBorder" Value="ThinRaised"/>
                </Trigger>
                <Trigger Property="IsKeyboardFocused" Value="True">
                    <Setter Property="BorderStyle" TargetName="ClassicBorder" Value="ThinPressed"/>
                </Trigger>
                <Trigger Property="IsSubmenuOpen" Value="True">
                    <Setter Property="BorderStyle" TargetName="ClassicBorder" Value="ThinPressed"/>
                </Trigger>
                <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="True"/>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <Style x:Key="MenuItemStyle1" TargetType="{x:Type MenuItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Background" Value="#00FFFFFF"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
            <Setter Property="Template" Value="{DynamicResource MenuItemControlTemplate3}"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Effect">
                        <Setter.Value>
                            <DropShadowEffect Color="Yellow"/>
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="Role" Value="TopLevelHeader">
                    <Setter Property="Margin" Value="0,1,0,1"/>
                    <Setter Property="Padding" Value="4,1,5,2"/>
                    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
                <Trigger Property="Role" Value="TopLevelItem">
                    <Setter Property="Margin" Value="0,1,0,1"/>
                    <Setter Property="Padding" Value="4,1,5,2"/>
                    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
                <Trigger Property="Role" Value="SubmenuHeader">
                    <Setter Property="DockPanel.Dock" Value="Top"/>
                    <Setter Property="Padding" Value="0,2,0,2"/>
                    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
                <Trigger Property="Role" Value="SubmenuItem">
                    <Setter Property="DockPanel.Dock" Value="Top"/>
                    <Setter Property="Padding" Value="0,2,0,2"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <ControlTemplate x:Key="MenuItemControlTemplate3" TargetType="{x:Type MenuItem}">
            <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition MinWidth="17" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
                        <ColumnDefinition Width="14"/>
                    </Grid.ColumnDefinitions>
                    <ContentPresenter Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" Content="{TemplateBinding Icon}" ContentSource="Icon"/>
                    <Path Visibility="Hidden" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z"/>
                    <ContentPresenter Margin="{TemplateBinding Padding}" Grid.Column="1" Content="{TemplateBinding Header}" ContentSource="Header" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" RecognizesAccessKey="True" x:Name="contentPresenter"/>
                    <TextBlock Margin="5,2,0,2" x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}" DockPanel.Dock="Right"/>
                </Grid>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="Icon" Value="{x:Null}">
                    <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
                </Trigger>
                <Trigger Property="IsChecked" Value="True">
                    <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
                    <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
                </Trigger>
                <Trigger Property="IsHighlighted" Value="True">
                    <Setter Property="Effect" TargetName="contentPresenter">
                        <Setter.Value>
                            <DropShadowEffect/>
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <Style x:Key="MenuItemStyle3" TargetType="{x:Type MenuItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Background" Value="#00FFFFFF"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
            <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Effect">
                        <Setter.Value>
                            <DropShadowEffect Color="Yellow"/>
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="Role" Value="TopLevelHeader">
                    <Setter Property="Margin" Value="0,1,0,1"/>
                    <Setter Property="Padding" Value="4,1,5,2"/>
                    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
                <Trigger Property="Role" Value="TopLevelItem">
                    <Setter Property="Margin" Value="0,1,0,1"/>
                    <Setter Property="Padding" Value="4,1,5,2"/>
                    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
                <Trigger Property="Role" Value="SubmenuHeader">
                    <Setter Property="DockPanel.Dock" Value="Top"/>
                    <Setter Property="Padding" Value="0,2,0,2"/>
                    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
                </Trigger>
                <Trigger Property="Role" Value="SubmenuItem">
                    <Setter Property="DockPanel.Dock" Value="Top"/>
                    <Setter Property="Padding" Value="0,2,0,2"/>
                </Trigger>
            </Style.Triggers>
        </Style>

    </Window.Resources>
    <Window.Top>
        <Binding Path="MainWindowTop" Mode="TwoWay" Source="{x:Static settings:Settings.Default}" />
    </Window.Top>
    <Window.Left>
        <Binding Path="MainWindowLeft" Mode="TwoWay" Source="{x:Static settings:Settings.Default}" />
    </Window.Left>
    <Window.Height>
        <Binding Path="MainWindowHeight" Mode="TwoWay" Source="{x:Static settings:Settings.Default}" />
    </Window.Height>
    <Window.Width>
        <Binding Path="MainWindowWidth" Mode="TwoWay" Source="{x:Static settings:Settings.Default}" />
    </Window.Width>
    <Window.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded"  >
            <BeginStoryboard    Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/>
        </EventTrigger>
    </Window.Triggers>
    <Window.Background>
        <LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
            <GradientStop Color="#FF000000" Offset="1"/>
            <GradientStop Color="#FF000000" Offset="0"/>
            <GradientStop Color="{Binding Path=WindowColorScheme, Mode=OneWay, Source={x:Static settings:Settings.Default}}" Offset="0.5" x:Name="middleStop"/>
        </LinearGradientBrush>
    </Window.Background>
    <Grid x:Name="grid">
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="50" />
            <RowDefinition Height="152*" />
            <RowDefinition Height="3"/>
            <RowDefinition Height="103*" />
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" MinWidth="150" x:Name="listCol" />
            <ColumnDefinition Width="3" />
            <ColumnDefinition Width="200*" />
        </Grid.ColumnDefinitions>
        <Menu Grid.ColumnSpan="3" Background="Transparent" x:Name="menu">
            <MenuItem Header="System" Foreground="White"   Template="{DynamicResource MenuItemControlTemplate1}" Style="{DynamicResource MenuItemStyle3}" >
                <MenuItem x:Name="LogOffMenu" Header="Exit" Style="{DynamicResource MenuItemStyle1}" Click="LogOffMenu_Click" Foreground="White" />
            </MenuItem>
            <MenuItem Header="Tools" Foreground="White"  Template="{DynamicResource MenuItemControlTemplate1}" Style="{DynamicResource MenuItemStyle3}" >
                <MenuItem x:Name="OnlineOptionsMenu" Click="OnlineOptionsMenu_Click" Header="Online Options" Foreground="White"  BorderThickness="0"  HorizontalContentAlignment="Left" Padding="0,0,0,0" VerticalContentAlignment="Top" Style="{DynamicResource MenuItemStyle1}" />
                <MenuItem x:Name="LocalOptionsMenu" Header="Local Options" Foreground="White"  BorderThickness="0"  HorizontalContentAlignment="Left" Padding="0,0,0,0" VerticalContentAlignment="Top" Style="{DynamicResource MenuItemStyle1}" Click="LocalOptionsMenu_Click" />
                <MenuItem Header="" Foreground="White"  BorderThickness="0"  HorizontalContentAlignment="Left" Padding="0,0,0,0" VerticalContentAlignment="Top" Style="{DynamicResource MenuItemStyle1}" Click="LocalOptionsMenu_Click" />

                <MenuItem x:Name="HistoryMenu" Header="History Viewer" Foreground="White"  BorderThickness="0"  HorizontalContentAlignment="Left" Padding="0,0,0,0" VerticalContentAlignment="Top" Style="{DynamicResource MenuItemStyle1}" />
                <MenuItem x:Name="DebugMenu" Header="Debug" Style="{DynamicResource MenuItemStyle1}" Foreground="White" Click="DebugMenu_Click" />
                <MenuItem x:Name="AdminMenu" Header="Administrator Menu" Style="{DynamicResource MenuItemStyle1}" Foreground="White" Click="AdminMenu_Click" VerticalContentAlignment="Top" />
            </MenuItem>
            <MenuItem x:Name="AboutMenu" Header="About" Foreground="White" Template="{DynamicResource MenuItemControlTemplate1}" Style="{DynamicResource MenuItemStyle3}" Click="AboutMenuItem_Click" />
        </Menu>
        <Grid HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="3" >  
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50*" Name="_infoCol0"/>
                <ColumnDefinition Width="10"/>
                <ColumnDefinition Width="50*" Name="_infoCol1"/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" Grid.Column="0">
                <Border MouseDown="_displayImage_MouseDown" Cursor="Hand" Name="_displayImage" CornerRadius="10" Height="50" Width="50" Margin="5,0,0,0">            
                </Border>
                <StackPanel Name="_localInfoSP" Margin="5,0,0,0">
                    <TextBlock MouseDown="_displayImage_MouseDown" Cursor="Hand" Name="_displayName" Text="Retrieving Info..." Foreground="White" FontFamily="Verdana" FontSize="20"  TextTrimming="CharacterEllipsis" Width="200"   />
                    <TextBlock MouseDown="_displayImage_MouseDown" Cursor="Hand" Name="_displayStatus"  Text="Please standby..." Foreground="White" FontFamily="Verdana" FontSize="12" Margin="10,0,0,0" TextTrimming="CharacterEllipsis" Width="200"  />
                </StackPanel>     
            </StackPanel>            
            <StackPanel HorizontalAlignment="Right"  Grid.Column="2" Orientation="Horizontal">
                <StackPanel HorizontalAlignment="Right" Margin="0,0,5,0" >
                    <TextBlock  HorizontalAlignment="Right" Name="_remoteDisplayName" Text="WGM BETA" Foreground="White" FontFamily="Verdana" FontSize="20" TextTrimming="CharacterEllipsis" Width="200" TextAlignment="Right" />
                    <TextBlock HorizontalAlignment="Right" Name="_remoteDisplayStatus" Text="...stand by" Foreground="White" FontFamily="Verdana" FontSize="12" Margin="10,0,0,0" TextTrimming="CharacterEllipsis" Width="200" TextAlignment="Right" />
                </StackPanel>
                <Border Cursor="Hand" CornerRadius="10" Name="_remoteImage" Height="50" Width="50" Margin="0,0,5,0">                
                </Border>
            </StackPanel>
        </Grid>
        <Border Grid.Row="2" Grid.RowSpan="3" BorderThickness="0,0,0,0" BorderBrush="#FF4F7B9F" Margin="5,2,2,2" CornerRadius="5,5,5,5" x:Name="border">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF000000" Offset="0"/>
                    <GradientStop Color="Transparent" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <Border.Effect>
                <DropShadowEffect Color="#FF464D4C" ShadowDepth="10"/>
            </Border.Effect>

            <Grid Height="Auto" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="25" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Text="Contacts" TextTrimming="CharacterEllipsis" FontSize="20">
                	<TextBlock.Foreground>
                		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                			<GradientStop Color="#FFF5F5F5" Offset="0"/>
                			<GradientStop Color="#FF708DAB" Offset="1"/>
                		</LinearGradientBrush>
                	</TextBlock.Foreground>
                </TextBlock>
                <ScrollViewer x:Name="ContactScroller" HorizontalScrollBarVisibility="Hidden" Grid.Row="1" IsEnabled="True"   Visibility="Visible" VerticalScrollBarVisibility="Auto" Template="{DynamicResource ScrollViewerControlTemplate1}">
                    <ListBox  ScrollViewer.HorizontalScrollBarVisibility="Hidden"  ScrollViewer.VerticalScrollBarVisibility="Hidden" IsSynchronizedWithCurrentItem="True"  x:Name="_contactListView"  BorderThickness="0" Grid.Row="1" Grid.RowSpan="3" Background="Transparent" Foreground="Wheat" ItemContainerStyle="{DynamicResource ContactListItemStyle}" ItemTemplate="{StaticResource ContactListTemplate}" />
                </ScrollViewer>
            </Grid>

        </Border>
        <GridSplitter ResizeDirection="Columns" Grid.Column="1" Grid.Row="1" Grid.RowSpan="4" ResizeBehavior="PreviousAndNext" Width="3" Background="#0068717D"  />
        <Border  Margin="2,2,2,2" Grid.ColumnSpan="1" Grid.Row="2" Grid.RowSpan="3" CornerRadius="5,5,5,5" Grid.Column="2" x:Name="border1">
            <TabControl   x:Name="_tabControl" BorderThickness="0,0,0,0"  Background="Black" BorderBrush="Black" Foreground="AliceBlue"  Width="Auto" Height="Auto" Padding="0" TabStripPlacement="Top">
                <TabControl.Resources>
                    <Style TargetType="{x:Type TabItem}">
                        <Setter Property="IsSelected" Value="{Binding Path=IsTabSelected, Mode=TwoWay}"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type TabItem}">
                                    <ControlTemplate.Resources>

                                        <SolidColorBrush x:Key="NormalBrush" Color="{Binding Path=TabHeaderColour}" />
                                        <SolidColorBrush x:Key="GlowBrush" Color="Orange" />

                                        <Storyboard x:Key="OnLoaded1" Duration="00:00:01" RepeatBehavior="2x" AutoReverse="True" FillBehavior="Stop">
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                                <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </ControlTemplate.Resources>
                                    <Grid Height="Auto" x:Name="grid" Panel.ZIndex="0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="0.896*"/>
                                            <ColumnDefinition Width="0.104*"/>
                                        </Grid.ColumnDefinitions>
                                        <Border x:Name="Border" BorderBrush="Black" BorderThickness="1,1,1,1" CornerRadius="6,6,0,0" Grid.ColumnSpan="2" >
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="#FF000000" Offset="0" x:Name="TabGradientStop"/>
                                                    <GradientStop Color="{Binding Path=TabHeaderColour}" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Border.Effect>
                                                <DropShadowEffect Color="Orange" Opacity="0" />
                                            </Border.Effect>
                                            <Grid >
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*"/>
                                                    <ColumnDefinition Width="25"/>
                                                </Grid.ColumnDefinitions>
                                                <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Left" ContentSource="Header" Margin="10,0,0,0" RenderTransformOrigin="0.5,0.5"  >
                                                    <ContentPresenter.RenderTransform>
                                                        <TransformGroup>
                                                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                                                            <SkewTransform AngleX="0" AngleY="0"/>
                                                            <RotateTransform Angle="0"/>
                                                            <TranslateTransform X="0" Y="0"/>
                                                        </TransformGroup>
                                                    </ContentPresenter.RenderTransform>
                                                </ContentPresenter>
                                            </Grid>
                                        </Border>
                                        <TextBlock FontSize="8" Foreground="Red" Cursor="Hand" Visibility="{Binding Path=CloseButtonVisibility}" Tag="{Binding Path=OutgoingTBName}" HorizontalAlignment="Right" Margin="0" VerticalAlignment="Top" Width="9" Height="9" Grid.Column="1"  x:Name="viewbox" MouseDown="viewbox_MouseDown">
        									<TextBlock.Text>
                                                X
                                            </TextBlock.Text>
                                        </TextBlock>
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="Selector.IsSelected" Value="False">
                                            <Setter Property="Opacity" TargetName="ContentSite" Value="0.6"/>

                                        </Trigger>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Effect" TargetName="ContentSite">
                                                <Setter.Value>
                                                    <DropShadowEffect Opacity="{Binding Path=TabOpacity}"/>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="Effect" TargetName="viewbox">
                                                <Setter.Value>
                                                    <DropShadowEffect Color="Red"  />
                                                </Setter.Value>
                                            </Setter>

                                        </Trigger>
                                        <Trigger Property="Selector.IsSelected" Value="True">
                                            <Setter Property="Effect" TargetName="Border">
                                                <Setter.Value>
                                                    <DropShadowEffect Color="{Binding Path=TabHeaderColour}" Opacity="{Binding Path=TabOpacity}" />
                                                </Setter.Value>
                                            </Setter>


                                        </Trigger>
                                        <DataTrigger Binding="{Binding Path=FlashTab}" Value="True"   >
                                            <DataTrigger.EnterActions>

                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Duration="00:00:1.75" AutoReverse="False" Storyboard.TargetName="Border"   Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Opacity)">
                                                            <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:0.25" Value="1"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:0.5" Value="0"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:0.75" Value="1"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:1" Value="0"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:1.25" Value="1"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:1.5" Value="0"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:1.75" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </DataTrigger.EnterActions>
                                            <Setter Property="Background" TargetName="Border">
                                                <Setter.Value>
                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                        <GradientStop Color="#FF000000" Offset="0" />
                                                        <GradientStop Color="{Binding Path=TabHeaderColour}" Offset="1"/>
                                                    </LinearGradientBrush>
                                                </Setter.Value>
                                            </Setter>
                                        </DataTrigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="Foreground" Value="White"/>
                        <Setter Property="Height" Value="20"/>
                    </Style>
                </TabControl.Resources>
                <TabControl.Effect>
                    <DropShadowEffect ShadowDepth="10" Color="#FF565151"/>
                </TabControl.Effect>

                <TabControl.ItemTemplate>
                    <DataTemplate>
                        <TextBlock ToolTip="{Binding Path=TabHeaderToolTip}"  Text="{Binding Path=TabHeaderText}" TextTrimming="CharacterEllipsis" MaxWidth="100" x:Name="textBlock" Opacity="{Binding Path=TabOpacity}" />
                    </DataTemplate>
                </TabControl.ItemTemplate>

                <TabControl.ContentTemplate >
                    <DataTemplate>
                        <Border CornerRadius="5,5,5,5">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="151*" />
                                    <RowDefinition Height="3"/>
                                    <RowDefinition Height="90*" />
                                </Grid.RowDefinitions>
                                <src:BindableRichTextBox  Document="{Binding Path=MessageDoc}" VerticalScrollBarVisibility="Auto" BorderThickness="0,0,0,0" TextChanged="BindableRichTextBox_TextChanged" Background="#FFF9F3F3" IsReadOnly="True" IsDocumentEnabled="True">
                                    <src:BindableRichTextBox.Resources>
                                        <Style TargetType="{x:Type ScrollViewer}">
                                            <Setter Property="Template" Value="{DynamicResource ScrollViewerControlTemplate1}"/>
                                        </Style>
                                    </src:BindableRichTextBox.Resources>
                                </src:BindableRichTextBox>
                                <GridSplitter   ResizeDirection="Rows"  Grid.Row="1" HorizontalAlignment="Stretch" ResizeBehavior="PreviousAndNext" Height="3"  VerticalAlignment="Top"  >
                                    <GridSplitter.Background>
                                        <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                            <GradientStop Color="White" Offset="0"/>
                                            <GradientStop Color="LightSteelBlue" Offset="1.6"/>
                                            <GradientStop Color="#FFFBFDFF" Offset="1"/>
                                            <GradientStop Color="#FF657B96" Offset="0.504"/>
                                        </LinearGradientBrush>
                                    </GridSplitter.Background>

                                </GridSplitter>

                                <src:BindableRichTextBox FontStyle="{Binding Path=MyFontStyle}" FontSize="{Binding Path=MyFontSize}" FontWeight="{Binding Path=MyFontWeight}" FontFamily="{Binding Path=MyFontFamily}" Foreground="{Binding Path=MyFontColour}"  SpellCheck.IsEnabled="True" Tag="{Binding Path=OutgoingTBName}" Document="{Binding Path=OutgoingText, Mode=TwoWay}"  Grid.Row="2" BorderThickness="0,0,0,0"  VerticalScrollBarVisibility="Auto" KeyUp="TextBox_KeyUp" IsDocumentEnabled="True">

                                    <src:BindableRichTextBox.Resources>
                                        <Style TargetType="{x:Type ScrollViewer}">
                                            <Setter Property="Template" Value="{DynamicResource ScrollViewerControlTemplate1}"/>
                                        </Style>
                                    </src:BindableRichTextBox.Resources>
                                    <src:BindableRichTextBox.Background>
                                        <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                            <GradientStop Color="White" Offset="0"/>
                                            <GradientStop Color="LightSteelBlue" Offset="1.6"/>
                                            <GradientStop Color="#FFF9F9F9" Offset="1"/>
                                        </LinearGradientBrush>
                                    </src:BindableRichTextBox.Background>
                                </src:BindableRichTextBox>
                            </Grid>
                        </Border>
                    </DataTemplate>
                </TabControl.ContentTemplate>


            </TabControl>


        </Border>
        <CheckBox Grid.Row="5"   IsChecked="{Binding Path=AutoScrollMessageWindow, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="3,7,0,-7" Grid.ColumnSpan="2">
            <Label Foreground="White" Content="Auto Scroll Messages"/>
        </CheckBox>
        <Ellipse x:Name="_connectionDisplay" Fill="#FF0000" Grid.Column="2" Grid.Row="5"  HorizontalAlignment="Right" Width="10" Margin="0,13,17,7"/>
    </Grid>

</Window>